package com.lx.txx.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lx.txx.dao.TxxCommentMapper;
import com.lx.txx.entity.TxxComment;
import com.lx.txx.entity.TxxCommentEx;
import com.lx.txx.service.impl.TxxCommentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("txxComment")
public class TxxCommentController {

    @Autowired
    TxxCommentMapper txxCommentMapper;

    @RequestMapping("putComment")
    public String putComment(@RequestBody TxxComment comment) {
        int num = txxCommentMapper.insert(comment);
        if(num > 0){
            return "评论成功";

        }else{
            return "评论失败";
        }
    }

    @RequestMapping("getCommentByCid")
    public List<TxxCommentEx> getCommentByCid(String id) {
        List<TxxCommentEx> txxComments = txxCommentMapper.selectByCId(id);
        return txxComments;
    }
}
